<#assign module="company"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/form.css">
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-switch.min.css">
<link rel="stylesheet" href="${ctx}/assets/css/uploadify.css">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>
<@override name="body">
<div class="row">
	<div class="col-md-12">
		<div class="tabbable"> <!-- Only required for left/right tabs -->
			  <ul class="nav nav-tabs">
			    <li class="active"><a href="#tab1" data-toggle="tab">客户二维码背景图</a></li>
			 </ul>
			 <form action="${ctx}/company/savepictures" class="form-horizontal" role="form" method="post">
			 		<input type="hidden" id="id" name="id" value="${company.id?if_exists}">
			  		<div class="tab-content">
						<div class="tab-pane fade in active" id="tab1">
					    	<div class="panel panel-default margin-top">
								<div class="panel-heading">
								背景图
								<button type="button" href="javascript:;" class="pull-right button button-pill button-flat-primary button-tiny " id="photo_upload_dialog"><i class="glyphicon glyphicon-open"></i>&nbsp;图片上传</button>
								</div>
								<div class="panel-body">
									<div class="col-md-5">
										<div class="form-group">
											 <label class="col-sm-6 control-label"></label>
										     <div class="col-sm-6">
												<img id="quickResponse_img" width="216" height="384" <#if company.picture??>src="${ctx}/${company.picture?if_exists}"</#if>/>
												<input style="display:none;" type="file" name="imgFile" id="quickResponse_file" accept=".bmp,.gif,.jpeg,.jpg,.png">
												<input type="hidden" id="picture" name="picture" value="${company.picture?if_exists}">
											</div>
										</div>	
									</div>
									<div class="col-md-6">
									
										<div class="form-group">
						                    <label class="col-sm-3 control-label">提示：</label>
						                    <div class="col-sm-6">
						                    	<p class="form-control-static">图片用于客户扫描二维码后看到的界面</p>
						                    	<p>建议大小：1080 x 1920</p>
						                    	<p>标题和内容用于分享后看见的文字</p>
						                    </div>
					                	</div>
					                	
					                	<div class="form-group">
						                    <label class="col-sm-3 control-label">标题：</label>
						                    <div class="col-sm-6">
						                    	<input class="form-control" id="introduceTitle" name="introduceTitle" type="text" value="${company.introduceTitle?if_exists}" />
						                    </div>
					                	</div>
					                	
					                	<div class="form-group">
						                    <label class="col-sm-3 control-label">内容：</label>
						                    <div class="col-sm-6">
						                    	<textarea rows="5" class="form-control" id="introduceContent" name="introduceContent">${company.introduceContent?if_exists}</textarea>
						                    </div>
					                	</div>
					                	
									</div>
								</div>
							</div>
						</div>
				
						<div class="tab-pane fade" id="tab6">
							<div class="panel panel-default margin-top">
								<div class="panel-heading">服务人员头像</div>
								<div class="panel-body">
									<div class="col-md-6">
										
									</div>
								</div>
							</div>
						</div>
				
						<div class="tab-pane fade" id="tab2">
							<div class="panel panel-default margin-top">
								<div class="panel-heading">公司LOGO</div>
								<div class="panel-body">
								    
								</div>
							</div>
						</div>
				
						<div class="tab-pane fade" id="tab3">
							<div class="panel panel-default margin-top">
								<div class="panel-heading">背景图片</div>
								<div class="panel-body">
								    
								</div>
							</div>
						</div>
						<div class="tab-pane fade" id="tab4">
							<div class="panel panel-default margin-top">
								<div class="panel-heading">xxxx</div>
								<div class="panel-body">
									
								</div>
							</div>
						</div>
				
						<div class="tab-pane fade" id="tab5">
							<div class="panel panel-default margin-top">
								<div class="panel-heading">xxx</div>
								<div class="panel-body">
								  
								</div>
							</div>
						</div>
				
						<div class="tab-pane fade" id="tab7">
							<div class="panel panel-default margin-top">
								<div class="panel-heading">xxxx</div>
								<div class="panel-body">
									
								</div>
							</div>
						</div>    
					</div>
					<div class="form-group">
					      <input type="submit" class="btn btn-primary center-block" value="保存">
					</div>
			  </form>
		</div>
	</div>
</div>
</@override>
<@override name="footer">
	<script src="${ctx}/assets/js/ajaxfileupload.js"></script>
	<script src="${ctx}/assets/kindeditor/kindeditor-all-min.js"></script>
	<script src="${ctx}/assets/kindeditor/lang/zh_CN.js"></script>
	<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
	<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
	<script src="${ctx}/assets/js/bootstrap-switch.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
		
			$("#photo_upload_dialog").click(function(){
				$("#quickResponse_file").click();
			});
			$(document).on('change','#quickResponse_file',function(){
				if($.trim($(this).val())){
				 	$.ajaxFileUpload({
		                url:'${ctx}/common/uploadimg',
		                secureuri:false,
		                fileElementId:'quickResponse_file',
		                dataType: 'json',
		                success: function (result, textStatus) {
		                	if(result.success){
		                		$.scojs_message("上传成功", $.scojs_message.TYPE_OK);
		                    	$("#quickResponse_img").attr("src","${ctx}/"+result.url);
		                    	$("#picture").val(result.url);
		                	}
		                	else{
		                		$.scojs_message(result.msg, $.scojs_message.TYPE_ERROR);
		                	}
		                }
		            });
				}
			});
			//提交表单
			$("#submit_form").submit(function(){
				if($("#picture").val()==""){
					$.scojs_message("请上传背景图片", $.scojs_message.TYPE_ERROR);
					return false;
				}
				return true;
			});
		});
	</script>
</@override>
<@extends name="../layout.ftl"/>